#include<bits/stdc++.h>
using namespace std;
const int N=1e5+1;
int n,a[N],x=0,y=0,A=1,f=1,r=2;
int main()
{
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
        if(a[i]>2)A=0;
        if(a[i]==1)x++;
        if(a[i]==2)y++;
    }
    if(A)
    {
        if(x>=y)cout<<x-y+y<<endl;
        else if(x<y)cout<<y<<endl;
    }
    else
    {
        sort(a+1,a+n+1);
        while(r<=n)
        {
            if(a[f]<a[r])f++,r++;
            else r++;
        }
        cout<<n-f+1<<endl;
    }
    return 0;
}
